A text buffer is a storage space in memory that is used to store text. The text buffer supports operation of a text editor. Text is stored in a buffer, and, when text is edited, the edited text is stored in a new version of the buffer. In a version tracking text buffer, the version of the buffer is updated each time an edit occurs. In such a tracking text buffer, as edits to the text are applied, new versions of the buffer are created in the same order that the edits are made. Thus, an edit made to text results in a new, updated version of the buffer. If another edit is then made to the text, the edit is applied to create another updated version of the text buffer.
Concurrent edits may also be made to text, in which case multiple edits are made to the same or similar version of the text buffer. Concurrent edits may occur when a document is being shared and edited by two users, agents, or processors, for example in a collaborative editing scenario. In such a situation, a first user may make a change to the text at substantially the same time a second user makes a change to the text. Obviously, both users expect their changes to apply in the manner in which they intended.
However, concurrent edits typically cannot be applied to the text, and stored in the text buffer, in the same manner as sequential edits. In fact, sequentially applying the concurrent edits to the text buffer causes undesirable effects. If one edit is applied to text and a new version of the buffer created, then applying a second edit to the new version results in an unwanted edit as the edit is being made to the new version instead of to the original version. Edits change the position of the text. For example, a deletion of two characters moves any succeeding characters to an earlier position. Similarly, an insertion of a character moves succeeding characters to a later text position. Therefore, if one edit involves a deletion and a second, concurrent edit involves an insertion, then the edits being applied in a sequential manner causes the second edit to occur at an unintended position.
Therefore, a mechanism that allows concurrent edits to be made to the same or similar version of a text buffer is desired.